package ps.client.gui.util.textpanel;

import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JComponent;
import javax.swing.JPanel;


@SuppressWarnings("serial")
public class MessageLine extends JPanel {
    
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gblCons = new GridBagConstraints();
    
    public MessageLine(JComponent comp) {
        this(new JComponent[] { comp });
    }
    
    public MessageLine(JComponent[] comps) {
        setLayout(gbl);
        
        gblCons.fill = GridBagConstraints.NONE;
        gblCons.weightx = 1.0;
        gblCons.insets = new Insets(1, 3, 1, 1);
        gblCons.anchor = GridBagConstraints.SOUTHWEST;
        
        for (int i = 0; i < comps.length; i++) {
            addComponent(comps[i]);
        }
    }
    
    public void addComponent(Component comp) {
        gbl.setConstraints(comp, gblCons);
        add(comp);
    }

    
}
